package string;

/**
 * Created by fengliejv on 2021/12/6.
 */
public class TruncateSentence1816 {
    public String truncateSentence(String s, int k) {
        String[] strings = s.split(" ");
        String result = "";
        for (int i = 0; i < k; i++) {
            result+=strings[i]+" ";
        }
        return result.trim();
    }
}
